//
//  SurpriseShopTableCell.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/8/11.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit

class SurpriseShopTableCell: BaseTableViewCell {
    
    var rootView : UIView?
    
//    var list : [SupriseDataListModel]?
    
    var type_list : [SurpTypeListModel]?{
        
        didSet{
            
            if type_list == nil {
                return
            }
            
            if type_list!.count > 0 {
                
                setupSubViews()
                
            }
            
            
        }
        
    }
    
    var subtabGun = false{
    
        didSet{
            
            if surpriseVC == nil {
                return
            }
        
            for item in surpriseVC!.childViewControllers as! [OneSurpriseColumnVC] {
                item.gun = subtabGun
                
        }
        
        
        }
    
    
    }
       
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
    }
    
    required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    }
    

    override func awakeFromNib() {
        super.awakeFromNib()
    }
    
    
    func setupSubViews() {
        
        if rootView == nil {
            
            surpriseVC = SurpriseColumnsVC()
            
            surpriseVC?.type_list = type_list
            
            rootView = surpriseVC!.view
            
            rootView?.frame = CGRect(x: 0, y: 0, width: KScreenW, height: KScreenH - 64)
            
            
            self.contentView.addSubview(rootView!)

        }
        
        
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
 
    }

}
